<?php
	/**
	 *	Copyright (c) TeamFlamingo And gray 2004-2009
	 *	www.me-live.com.cn / www.i-gray.cn
	 *
	 *	[ WARNING ]
	 *		This is NOT a freeware!
	 *		You MUST get author's authorization before using it!
	 *	[ WARNING ]
	 *
	 *	Name : Ajax.php / Development Code Evolve
	 *	Created / Modify : 2010-2-18 / --
	 */

	include	'../init.php';

	$action	=	array( 'login', 'register', 'childForums' );

	$hash	=	isset( $_GET['h'] ) && !empty( $_GET['h'] ) ? trim( $_GET['h'] ) : isset( $_POST['h'] ) && !empty( $_GET['h'] ) ? trim( $_POST['h'] ) : false;

	if( !isset( $_GET['do'] ) || !in_array( $_GET['do'], $action ) )
		//return	'';
		if( !isset( $_POST['do'] ) || !in_array( $_POST['do'], $action ) )
			return;

	//if( !$hash )	return	'';
	switch ( $_GET['do'] )
	{
		case	'login'	:
		case	'register'	:
			include	ME_CORE . '/template.h.php';
			echo	@file_get_contents( AjaxTemplate( "{$_GET['do']}_window" ) );
		break;

		case	'childForums'	:
			include ME_FORUM_CACHE_FILE;
			$fid	=	getMeInt( $_GET['fid'] );
			$cid	=	getMeInt( $_GET['cid'] );

			switch	( $cid )
			{
				case	'1'	:	$child	=	'firstParentId';	break;
				case	'2'	:	$child	=	'secondParentId';	break;
				case	'3'	:	$child	=	'thirdParentId';	break;
			}

			$arr	=	array();
			//echo	$child;
			foreach( $forumsResult as $value )
			{
				if( $value[$child] == $fid )
				//	echo	$value[$child];
					$arr[]	=	implode( '|', $value );
			}

			$str	=	implode( '||', $arr );
			echo	$str;
			//echo	$forumsResult[0]['fid'];
			//echo	$cid;
		break;
	}
?>